
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
            <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
            
            <title>Test JSAPI</title>
            <style type="text/css">
                
                #main {
                }
            
            .singleLine, .half {
                height: 35px;
                margin-left: 6%;
                width: 80%;
                font-size: 12px;
            }
            
            .halfLeft {
                width: 28%;
            }
            
            .halfRight {
                width: 46%;
            }
            
            .singleLine {
                margin-top: 10px;
                width: 86%
            }
            
            .btn {
                margin-left: 6%;
                margin-top: 10px;
                width: 86%;
                font-size: 15px;
                height: 30px;
            }
            
            #content {
                margin-left: 6%;
                margin-top: 10px;
                width: 86%;
                font-size: 12px;
                color: #888888;
            }
            
            
                </style>
            </head>
    <body>
        <div id="main" width = "100%" height = "100%">
            
            <!--            <input id="apiName" class="singleLine" type="text" placeholder="API调用名，如remoteLog"  size="14" />-->
            <!--            <div id = "key_value">-->
            <!--                <p><input id = "key1" class="half halfLeft" type="text" placeholder="参数名"  size="14" /> :-->
            <!--                <input id= "value1" class="half halfRight" type="text" placeholder="参数值"  size="14" /></p>-->
            <!--                <p><input id = "key2" class="half halfLeft" type="text" placeholder="参数名"  size="14" /> :-->
            <!--                <input id= "value2" class="half halfRight" type="text" placeholder="参数值"  size="14" /></p>-->
            <!--                <p><input id = "key3" class="half halfLeft" type="text" placeholder="参数名"  size="14" /> :-->
            <!--                <input id= "value3" class="half halfRight" type="text" placeholder="参数值"  size="14" /></p>-->
            <!--            </div>-->
            
            <button class="btn" /><a href="alipayqr://platformapi/startapp?saId=10000007">打开scheme-alipay付款</a></button>
            <button class="btn" /><a href="alipays://">打开scheme-alipay无参数</a></button>
            <button class="btn" /><a href="alipays://">打开scheme-alipay1</a></button>
            <button class="btn" onclick= '' /><a href="alipays://platformapi/startapp?appId=20000067&url=https://render.alipay.com/p/c/17u8fud0e5y8?enableWK=YES&transparentTitle=none&allowsBounceVertical=NO&appClearTop=false&startMultApp=YES">打开scheme-alipay</a></button>
            <button class="btn" onclick= 'makeCall()' /><a href="https://www.taobao.com/"> 打电话</a></button>
            <button class="btn" onclick= 'cebpushwindow()' />pushwindow</button>
            <button class="btn" onclick= 'openAppId()' />打开离线包</button>
            <button class="btn" onclick= 'openApp()' /><a href="yghsh://">打开scheme-yghsh</a></button>
            <button class="btn" onclick= '' /><a href="com.cebbank.xyk://">[打开scheme-com.cebbank.xyk]</a></button>
            <button class="btn" onclick= 'openApp0()' />[打开scheme-href=com.cebbank.xyk]</button>
            
            <button class="btn" onclick= 'openApp1()' /><a href="https://cwma.cebbank.com/applinkUL/">打开UL</a></button>

            <button class="btn" onclick= 'openApp2()' /><a href="https://cwma.cebbank.com/applinkUL?jump=sss">打开UL带参数</a></button>
            <button class="btn"                       /><a href="https://cmps.cebbank.com/applinkUL">打开UL无参数/非cwma</a></button>
            <button class="btn" onclick= 'openApp3()' /><a href="https://www.taobao.com/openapp/">打开UL-淘宝</a></button>
            <a href="https://m.letv.com/u_links/">打开UL-letv</a></br>
            <a href="https://www.iqiyi.com/app/">打开UL-iqiyi</a></br>
            <a href="https://link-jump.youku.com/a/play/">打开UL-youku</a></br>
            <a href="https://cwma.cebbank.com/applinkUL">打开UL-yghsh</a></br>
            <a href="https://m.aomygod.com/product">打开UL-aomygod</a></br>

            <a href="https://cwma.cebbank.com/applinkUL?channel=SCHEME_ADVERT&avdertId=110012101050000001">打开UL-年度账单</a></br>
            <a href="https://mod3.koubei.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D20000067%26url%3Dhttps%253A%252F%252Frender.alipay.com%252Fp%252Fc%252F17u8fud0e5y8%253FenableWK%253DYES%26transparentTitle%3Dnone%26allowsBounceVertical%3DNO%26appClearTop%3Dfalse%26startMultApp%3DYES">koubei</a></br>



            
        https://www.iqiyi.com/apple-app-site-association
            
            <script type="text/javascript">
                
                function addKeyValue () {
                    var count = document.getElementsByClassName('half').length;
                    count /= 2;
                    count += 1;
                    var kv = document.getElementById('key_value');
                    kv.innerHTML += "<p><input id=\"key" +  count  + "\" class=\"half halfLeft\" type=\"text\" placeholder=\"参数名\"  size=\"14\" \/> : <input id=\"value" + count + "\"class=\"half halfRight\" type=\"text\" placeholder=\"参数值\"  size=\"14\" \/></p>";
                }
            <!--            alert(11)-->
            function execute () {
                var count = document.getElementsByClassName('half').length;
                count /= 2;
                
                var params = {};
                for (var i = 1; i <= count; i++) {
                    var key = document.getElementById('key'+i).value;
                    var value = document.getElementById('value'+i).value;
                    if (key.length > 0 && value.length > 0) {
                        if (!isNaN(value)) {
                            value = Number(value);
                        }
                        params[key] = value;
                    }
                };
                var alertParams = {
                  "title":"提示",
                  "message":"我是正文",
                  "negMsg":"确定",
                  "posMsg":"取消",
                  "negListener":"onNeg",
                  "posListener":"onPos"
                };
                
                var name = document.getElementById('apiName').value.trim();
                
                window.AlipayJSBridge && AlipayJSBridge.call(name, params, function(data) {
                                                             var s =  JSON.stringify(data, null, 4);
                                                             var content = document.getElementById('content');
                                                             content.innerHTML = "<div><pre>" + s + "</pre></div>";
                                                             });
            }
            function set_home_titleView(){
                window.AlipayJSBridge && AlipayJSBridge.call('keyboardApi', {'action':'open'}, function(data) {
                                                             var s =  JSON.stringify(data);
                                                             alert('s='+s)
                                                             });
            }
            function testLog() {
                AlipayJSBridge.call("logH5Console",{log:"info"});
            }
            function keyboard_cl(){
                window.AlipayJSBridge && AlipayJSBridge.call('keyboardApi', {'action':'close'}, function(data) {
                                                             var s =  JSON.stringify(data);
                                                             alert('s='+s)
                                                             });
            }
            function keyboard_clearcache(){
                
                window.AlipayJSBridge && AlipayJSBridge.call('clearCache', {'type':'0'}, function(data) {
                                                             var s =  JSON.stringify(data);
                                                             alert('s='+s)
                                                             });
            }
            function keyboard_versioncheck(){
                window.AlipayJSBridge && AlipayJSBridge.call('versionCheck', {}, function(data) {
                                                             var s =  JSON.stringify(data);
                                                             alert('s='+s)
                                                             });
            }
            
            function app_help(){
                window.AlipayJSBridge && AlipayJSBridge.call('bridgeParam', {}, function(data) {
                                                             var s =  JSON.stringify(data);
                                                             alert('bridgeParam='+s)
                                                             });
            }
            function appid_open(){
                window.AlipayJSBridge && AlipayJSBridge.call('bridgeParam', {}, function(data) {
                                                             var s =  JSON.stringify(data);
                                                             <!--                                                             alert('bridgeParam='+s)-->
                                                             appid = data.appId;
                                                             <!--                                                             alert('appid='+appid)-->
                                                             startApp(appid);
                                                             
                                                             });
            }
            
            function startApp(){
                // 获取输入框的值
                appid = "20190926"
                appid = document.getElementById('input001').value;
<!--                alert(appid)-->
                window.AlipayJSBridge && AlipayJSBridge.call("startApp", {'appId':appid}, function(data) {
                                                             alert('调用结果'+JSON.stringify(data));
                                                             });
            }
            
            function jsapi_call(apiName, params) {
                window.AlipayJSBridge && AlipayJSBridge.call(apiName, params, function(data) {
                                                             alert('调用结果'+JSON.stringify(data));
                                                             });
            }
            
            
            function rpc_jsapi_test() {
                window.AlipayJSBridge && AlipayJSBridge.call('rpc',{
                                                             operationType:'com.cmps.cebbank.keepAlive.do',
                                                             requestData:[{"_requestBody":{}}],
                                                             headers:{}
                                                             },
                                                             function(data) {alert('调用结果'+JSON.stringify(data));
                                                             });
                                                             
            }
            function rpc_jsapi_test1() {
                window.AlipayJSBridge && AlipayJSBridge.call('rpc',{
                                                             operationType:'com.cmps.cebbank.setPreMsg',
                                                             requestData:[{"preMsg":"131231321",
                                                             "ccuserId":"8c29a8dc-70df-48e8-a587-ec384441804f",
                                                             "LoginPhone":"15737648126",
                                                                          "cardNbr":"62342343285577"}],
                                                             headers:{}
                                                             },
                                                             function(data) {alert('调用结果'+JSON.stringify(data));
                                                             });
                                                             
            }
            function rpc_jsapi_test2() {
                window.AlipayJSBridge && AlipayJSBridge.call('rpc',{
                                                             operationType:'com.cmps.cebbank.toNewCardActivityLogOut',
                                                             requestData:[{}],
                                                             headers:{}
                                                             },
                                                             function(data) {alert('调用结果'+JSON.stringify(data));
                                                             });
                                                             
            }
            
<!--            [APCommonPreferences setString:@"654321" forKey:@"ccuserid" business:@""];-->
            function app_storage_save(){
                AlipayJSBridge.call('setAPDataStorage', {
                  type: "common",
                  business: "",
                  key: "ccuserid",
                  value: "123456"
                }, function(result) {
                  alert(JSON.stringify(result));
                });
            }
            function app_storage_read(){
                AlipayJSBridge.call('getAPDataStorage', {
                  type: "common",
                  business: "",
                  key: "ccuserid",
                }, function(result) {
                  alert(JSON.stringify(result));
                });
            }
            function app_storage_rm(){
                AlipayJSBridge.call('removeAPDataStorage', {
                  type: "common",
                  business: "",
                  key: "ccuserid",
                }, function(result) {
                  alert(JSON.stringify(result));
                });
            }
            
            
            
            
            function app_starturl(){
                
                AlipayJSBridge.call('pushWindow', {
                                    url: 'https://ceb-page.g-town.com.cn/elm/activity.html',
                                    param: {
                                    readTitle: true,
                                    showOptionMenu: false
                                    }
                                    });
            }
            function app_openLocalRUrl(url){
                if(url){
                    AlipayJSBridge.call('pushWindow', {
                                        url: url,
                                        param: {
                                        readTitle: true,
                                        showOptionMenu: false
                                        }
                                        });
                }else{
                    alert("URL为空");
                }
            }
            function app_hud_show(){
                    jsapi_call("showProDialog")

                    setTimeout(function(){app_hud_hide();},3000)
            }
            function app_hud_hide(){
                    jsapi_call("dismissProDialog")
            }
            function showAlert(){
                jsapi_call("showDialog",{
                  "title":"提示",
                  "message":"我是正文",
                  "negMsg":"取消",
                  "posMsg":"确定",
                  "negListener":"onNeg",
                  "posListener":"onPos"
                })
            }
            function sm2(){
                jsapi_call("getEncryptSm2",{
                  "originalPwd":"123456",
                  "publicKey":"0493182C89C55C675D4EEA7B27424C8DA60419833639628566B5BE0C7F12438B2945846B3CA8E1A90E68A794AC5A574490C0922F7A0F5A18F63288C75BFD6A7A64"
                })
            }
            
            function makeCall(){
                jsapi_call("makeCall",{
                  "phoneNbr":"123456",
                })
            }
            function cebpushwindow(){
                // 打开淘宝首页，自动读取 title，并且去除右边菜单按钮
                AlipayJSBridge.call('pushWindow', {
                  url: 'https://m.baidu.com/', // 要打开页面的 URL
                  // 打开页面的配置参数
                  param: {
                    readTitle: true,    //自动读取 title
                    showOptionMenu: false    // 隐藏右边菜单
                  },
                });
            }
            function openAppId(){
                AlipayJSBridge.call('startH5App', {
                                    appId: '20206020'
<!--                  url: '/www/index.html',-->
                });
            }
            function openApp0(){
               window.location.href = "com.cebbank.xyk://"
            }
            function openApp(){
            // window.location.href = "https://cwma.cebbank.com/applinkUL/";
            

            var timeout, t = 1000, hasApp = true;  
            var openScript = setTimeout(function () {  
                              if (!hasApp) {
                                   // 跳转下载链接
                                    window.location.href = "https://www.baidu.com";
                              }
                            }, 2000)  
                
            var t1 = Date.now();  
          // 使用a标签方法或iframe方法触发URL Scheme
            location.href = "https://cwma.cebbank.com/applinkUL/";
            timeout = setTimeout(function () {  
              var t2 = Date.now();  
              if (t2 - t1 < t + 100) {  
                 hasApp = false;
              }
            }, t);
          }



            document.addEventListener('keyboardText', function(data){
                                      <!--                                      alert("来自原生的字符串："+JSON.stringify(data))-->
                                      console.log('------');
                                      console.log(JSON.stringify(data));
                                      console.log('------');
                                      });
                                      
                                      
                                      
                </script>
            </body>
</html>

